/*
helferlein.com ( http://www.helferlein.com )
Michael Tobisch

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions 
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Data;
using DotNetNuke.Framework;

namespace helferlein.DNN.Modules.Form.Data
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// An abstract class that provides the DAL contract for the Form Module
    /// </summary>
    /// <remarks>
    /// </remarks>
    /// <history>
    /// </history>
    /// -----------------------------------------------------------------------------
   public abstract class DataProvider
   {
#region Shared/Static Methods
      // singleton reference to the instantiated object
      static DataProvider provider = null;
      private const string PROVIDER_TYPE = "data";

      // constructor
      static DataProvider()
      {
         CreateProvider();
      }

      // dynamically create provider
      private static void CreateProvider()
      {
         if (provider == null)
            provider = (DataProvider)Reflection.CreateObject(PROVIDER_TYPE, "helferlein.DNN.Modules.Form.Data", "");
      }

      // return the provider
      public static DataProvider Instance()
      {
         return provider;
      }
#endregion

#region FormItem Abstract Methods 
      public abstract int AddFormItem(int moduleID, int formItemType, int? formItemRepeatColumns, int sortOrder, bool formItemRequired, bool formItemOther, int? width, int? height, int? formItemLinkTarget, string validationExpression, string aquarium);
      public abstract IDataReader GetFormItem(int formItemID);
      public abstract IDataReader GetFormItems(int moduleID);
      public abstract void UpdateFormItem(int moduleID, int formItemID, int formItemType, int? formItemRepeatColumns, int sortOrder, bool formItemRequired, bool formItemOther, int? width, int? height, int? formItemLinkTarget, string validationExpression, string aquarium);
      public abstract void DeleteFormItem(int formItemID);
      public abstract int GetNextSortValue(int moduleID);
      public abstract void RequireItem(int formItemID);
      public abstract void MoveTop(int formItemID);
      public abstract void MoveBottom(int formItemID);
      public abstract void Move(int formItemID, int direction);
#endregion

#region FormSubmission Abstract Methods
      public abstract int AddFormSubmission(int moduleID, DateTime formSubmissionDate, string formSubmission, bool formSubmissionApproved, string formSubmissionIPAddress, string formSubmissionLocale);
      public abstract IDataReader GetFormSubmission(int formSubmissionID);
      public abstract IDataReader GetFormSubmissions(int moduleID);
      public abstract IDataReader GetCurrentFormSubmissions(int moduleID, DateTime formSubmissionDate);
      public abstract IDataReader GetPublicFormSubmissions(int moduleID, DateTime formSubmissionDate);
      public abstract void UpdateFormSubmission(int moduleID, int formSubmissionID, DateTime formSubmissionDate, string formSubmission, bool formSubmissionApproved, string formSubmissionIPAddress, string formSubmissionLocale);
      public abstract void DeleteFormSubmission(int formSubmissionID);
      public abstract void DeleteAllFormSubmissions(int moduleID);
#endregion
   }
}